Video playing method and apparatus

ABSTRACT

Provided are a video playing method and apparatus. Wherein the video playing method comprises: performing video-preprocessing on video data to be played and playing the video data obtained after the video-preprocessing by means of a main process of the Web client; in the case that the performance resource of the Web client is insufficient, creating and starting a video service process, wherein the video service process is configured to perform the video-preprocessing on video data to be played and play the video data obtained after the video-preprocessing. In the technical solution according to the embodiment in the present application, the main process of the Web client can play videos without relying on plug-ins. In the case that the performance resource of the Web client is insufficient, the video service process is used to play videos for the smoothness of video playing, which can also play videos without relying on plug-ins. Thus, videos can be played without relying on plug-ins by means of this solution.

The present application claims the priority to a Chinese patentapplication No. 201811214952.8, filed with the China NationalIntellectual Property Administration on Oct. 18, 2018 and entitled“VIDEO PLAYING METHOD AND APPARATUS”, which is incorporated herein byreference in its entirety.

TECHNICAL FIELD

The present application relates to the technical field of multimedia,and in particular, to a video playing method and apparatus.

BACKGROUND

With the development of network technology, users can use the browser toplay videos online. Currently, video playing in the browser requiresplug-ins. Common plug-ins include NPAPI (Netscape Plugin ApplicationProgramming Interface) plug-ins and ActiveX plug-ins. The NPAPI plug-inor ActiveX plug-in is embedded in the browser, and the plug-in receivesthe video data through the established long connection. After receivingthe video data, the plug-in calls a decoding library and a renderinglibrary to decode and render the video data. The video can be played inthe browser after decoding and rendering.

However, after the plug-in is embedded in the browser, the plug-in willacquire higher permissions, such as monitoring web browsing records,installing malicious programs in the background, and generating pop-upwindows without authorization. This leads to network security issues.Based on this, most browsers nowadays have disabled plug-ins. Therefore,how to play videos in the browser without relying on plug-ins is anurgent problem to be solved.

SUMMARY

The purpose of the embodiments of the present application is to providea video playing method and apparatus, so as to realize that videos canbe played without relying on plug-ins. The specific technical solutionsare as follows.

In a first aspect, an embodiment of the present application provides avideo playing method, which is applied to a Web client. The methodincludes:

-   -   performing video-preprocessing on video data to be played, and        playing the video data obtained after the video-preprocessing by        means of a main process of the Web client;    -   creating and starting a video service process when the        performance resource of the Web client is insufficient, wherein        the video service process is configured to perform the        video-preprocessing on video data to be played and play the        video data obtained after the video-preprocessing.

In a second aspect, an embodiment of the present application provides avideo playing apparatus, which is applied to a Web client. The apparatusincludes:

-   -   a processing module, configured for performing        video-preprocessing on video data to be played and playing the        video data obtained after the video-preprocessing by means of a        main process of the Web client;    -   a creation module, configured for creating and starting a video        service process when the performance resource of the Web client        is insufficient, wherein the video service process is configured        to perform the video-preprocessing on video data to be played        and play the video data obtained after the video-preprocessing.

In a third aspect, an embodiment of the present application provides anelectronic device including a processor, a communication interface, amemory and a communication bus, wherein the processor, the communicationinterface, and the memory are communicated with each other via thecommunication bus;

-   -   the memory is used for storing computer programs;    -   the processor is used for implementing steps of any video        playing method described above when executing the programs        stored on the memory.

In a fourth aspect, an embodiment of the present application provides amachine readable storage medium. The machine readable storage mediumstores computer programs thereon which, when executed by a processor,cause the processor to implement the steps of any video playing methoddescribed above.

In a fifth aspect, an embodiment of the present application provides acomputer program product, which implements the steps of any videoplaying method described above when executed by a processor.

In the technical solutions provided in the embodiments of thisapplication, the main process of the Web client performsvideo-preprocessing on video data to be played and plays the video dataobtained after the video-preprocessing; and creates and starts a videoservice process when the performance resource of the Web client isinsufficient. Wherein the video service process is configured to performthe video-preprocessing on video data to be played and play the videodata obtained after the video-preprocessing. In the technical solutionaccording to the embodiment in the present application, the main processof the Web client can play videos without relying on plug-ins. When theperformance resource of the Web client is insufficient, the videoservice process is used to play videos for the smoothness of videoplaying, which can also play videos without relying on plug-ins. Thus,videos can be played without relying on plug-ins by means of thissolution.

BRIEF DESCRIPTION OF THE DRAWINGS

In order to more clearly describe the technical solutions of theembodiments of the present application and the prior art, drawingsneeded in the embodiments and the prior art will be briefly describedbelow. Obviously, the drawings described below are only some embodimentsof the present application, those of ordinary skills in the art can alsoobtain other drawings based on these drawings without any creativeefforts.

FIG. 1 is a flowchart of a video playing method according to anembodiment of the present application;

FIG. 2 is another flowchart of a video playing method according to anembodiment of the present application;

FIG. 3 is a schematic structural diagram of a video playing apparatusaccording to an embodiment of the present application;

FIG. 4 is a schematic structural diagram of an electronic deviceaccording to an embodiment of the present application.

DETAILED DESCRIPTION

In order to make objectives, technical solutions and advantages of thepresent application more apparent, the present application now will bedescribed in detail with reference to the accompanying drawings and byway of examples. Obviously, the embodiments described are only some,rather than all, of the embodiments of the present application. Allother embodiments obtained by those of ordinary skills in the art basedon the embodiments herein without any creative efforts are within thescope of the present application.

In order to play videos without relying on plug-ins, embodiments of thepresent application provide a video playing method and apparatus.Wherein the video playing method includes:

-   -   performing video-preprocessing on video data to be played and        playing the video data obtained after the video-preprocessing by        means of a main process of the Web client;    -   creating and starting a video service process when the        performance resource of the Web client is insufficient, wherein        the video service process is configured to perform the        video-preprocessing on video data to be played and play the        video data obtained after the video-preprocessing.

In the technical solution according to the embodiment in the presentapplication, the main process of the Web client can play videos withoutrelying on plug-ins. When the performance resource of the Web client isinsufficient, the video service process is used to play videos for thesmoothness of video playing, which can also play videos without relyingon plug-ins. Thus, videos can be played without relying on plug-ins bymeans of this solution.

A video playing method according to an embodiment of the presentapplication will be described below. The video playing method accordingto the embodiment of this application can be applied to a Web client.Wherein the Web client may be a Web page in an application. For example,the Web client may be a Web page in a browser, through which videos canbe played by the user. The web client may also be a Web page in otherapplications that can provide Web functions, which will not be repeatedhere.

As shown in FIG. 1 , a video playing method according to an embodimentof the present application includes the following steps:

At S101, performing video-preprocessing on video data to be played, andplaying the video data obtained after the video-preprocessing by meansof a main process of the Web client.

Wherein the main process of the Web client is a process created by theWeb client itself, and playing videos through the Web client can berealized by the main process of the Web client.

The video-preprocessing of the video data includes at least one ofdecapsulation processing, decoding processing, rendering processing andthe like. The video-preprocessing may also include other videoprocessing methods, which are not limited here.

In one implementation, the main process of the Web client can acquirethe video data to be played.

Wherein, the video data to be played can be determined according to userinstructions. For example, the Web client is a browser client, the useruses the browser to browse a video website and clicks a link of video“a” on the video website. At this time, the video “a” is determined asthe video to be played, and the Web client can acquire an instruction toplay the video “a”.

In one implementation, the main process of the Web client can acquirethe video data to be played from a server. Wherein, the Web client cancommunicate with the server through a WebSocket protocol. There are atleast two ways for the main process to acquire the video data from aserver.

In the first way, the server can actively send the video data to beplayed to the main process of the Web client. Wherein the server candetermine, based on the frame rate and code rate of the acquired videodata, the rate at which the video data is sent to the Web client.

In the second way, the Web client can acquire the video data to beplayed from the server by calling a WebSocket callback function.

The way the main process of the Web client acquires the video data fromthe server is not limited to the above two mays, and may also includeother acquiring methods, which are not limited here.

Wherein the main process of the Web client may acquire the video datafrom the server continuously, or may acquire all the video data at oneor more times.

After acquiring the video data to be played, the main process of the Webclient can decapsulate the acquired video data.

In one implementation, the main process of the Web client candecapsulate the acquired video data through a Javascript/WASM(WebAssembly). Wherein WASM runs in a sandboxed execution environmentand can be implemented in the existing JavaScript virtual machine. TheWebAssembly can be called by the JavaScript and enter the context of theJavaScript, so as to realize the decapsulation processing of theacquired video data.

After completing the decapsulation processing, the main process of theWeb client may decode the decapsulated video data.

In one implementation, the main process of the Web client can performdecoding processing on the decapsulated video data through theJavascript/WASM. Wherein in order to prevent a large amount of undecodedvideo data in the main process from causing too heavy load on the mainprocess, the main process of the Web client can monitor the amount ofcurrently undecoded video data in the main process.

After completing the decoding process, the main process of the Webclient may perform rendering processing on the video data obtained afterthe decoding processing, and play the rendered video data.

In one implementation, the main process of the Web client can performrendering processing on the decoded video data through a WebGL (WebGraphics Library) rendering. Wherein the WebGL is a 3D(three-dimensional) drawing protocol. The WebGL can provide 3Daccelerated rendering, so that the main process of the Web client candisplay 3D scenes and models more smoothly.

The main process of the Web client can play videos without relying onplug-ins. The main process performs video-preprocessing on and playsvideo data to be played, and thus videos can be played without relyingon plug-ins.

At S102, creating and starting a video service process when theperformance resource of the Web client is insufficient.

Wherein the video service process is configured to perform thevideo-preprocessing on video data to be played and play the video dataobtained after the video-preprocessing.

After the video service process is created and started, a connection isestablished between the main process and the video service process.After connected with the main process of the Web client, the videoservice process can receive instructions issued by the main process andperform corresponding operations.

After a connection is established between the main process and the videoservice process, the video service process may perform thevideo-preprocessing on video data to be played, and play video dataobtained after the video-preprocessing.

In one implementation, the main process of the Web client sends a videoplaying instruction to the video service process after receiving thevideo playing instruction. The video service process can create a videowindow after receiving the video playing instruction. The video windowis a window for displaying the played video, that is, the video isplayed in the video window.

The created video window is displayed in an interface of a running Webclient. For example, when the Web client is a browser client, the videowindow is displayed in the interface where the current window of thebrowser is located. In addition, the video window can change as theinterface of the running Web client changes. For example, when theinterface of the running Web client is stretched, the video window isstretched according to a certain ratio; when the interface of therunning Web client moves, the video window moves in the moving directionof the interface. In this way, the effect that the video window isembedded in the interface of a running Web client can be achieved.

After creating the video window, the video service process acquires thevideo data to be played according to the video playing instruction.Wherein the video service process can acquire the video data to beplayed from the server. There are at least two ways for the videoservice process to obtain video data from the server. In the first way,the server can actively send the video data to be played to the videoservice process. In the second way, the video service can acquire thevideo data to be played from the server by calling a WebSocket callbackfunction.

The way the video service process acquires the video data from theserver is not limited to the above two ways, and may also include otheracquiring methods, which are not limited here.

After acquiring the video data to be played, the video service processcan perform decapsulation processing on the acquired video data. Afterthe decapsulation processing is completed, the decapsulated video datais decoded. After the decoding process is completed, the video serviceprocess renders the decoded video data, and plays the rendered videodata in the video window.

Wherein, the process of decapsulation processing, decoding processing,and rendering processing performed by the video service process issimilar to that of decapsulation processing, decoding processing, andrendering processing performed by the main process of the Web client,and will not be repeated here.

Wherein, the video service process may be a process created by programs,other than the Web client, to perform the video-preprocessing on videodata. For example, the video service process may be a process created byan installed application, or a process created by a system itself, thesystem is a system run by a device in which a Web client is installed.

In one implementation, when the performance resource of the Web clientis insufficient, the Web client may also prompt the user to choosewhether to create a video service process.

Wherein, the prompt may be realized using at least one of a text prompt,a voice prompt, an image prompt, and the like. In one implementation,when there is a display screen for the Web client, the prompt can bedisplayed in text on the display screen. And two buttons are displayedon the display screen for the user to choose, one indicating thecreation of a video service process, and the other indicating nocreation of a video service process.

In the case that the user chooses to create a video service process, theWeb client creates and starts the video service process, and establishesa connection between the video service process and the main process.

In one implementation, in the case that the user chooses not to create avideo service process, the video data to be played may be subjected to aframe-extraction-processing. Wherein in one implementation of theframe-extraction-processing, the frame-extraction-processing can beperformed on the video data to be played according to a preset frameextraction rule.

Wherein the preset frame extraction rule can be customized. In oneimplementation, the frame extraction rule may be that a second number offrame images are extracted every other first number of frame images.Wherein both the first number and the second number can be customized.For example, the first number is 5 and the second number is 1, and thepreset frame extraction rule is to extract 1 frame image every other 5frame images.

After the frame-extraction-processing is completed, the main processperforms the video-preprocessing on the video data obtained after theframe-extraction-processing, and plays the video data obtained after thevideo-preprocessing.

Through this implementation, after the frame-extraction-processing, thenumber of frame images on which the main process performs thevideo-preprocessing in a unit time will be reduced, and the loadpressure of the main process will be reduced, so that in the unit time,the main process can complete the video-preprocessing on a reducedcertain number of frame images, which leads to smooth video playing.

In one implementation, the above step of creating and starting the videoservice process (S102) may include the following steps.

An installation package of the video service process is acquired andinstalled. Wherein the installation package of the video service processcan be pre-stored in the Web client. In this way, the Web client candirectly acquire the installation package locally and install theinstallation package.

After the installation is completed, it can be considered that thecreation of the video service process is successful, and then the videoservice process is started, and a connection between the video serviceprocess and the main process is established.

In one implementation, insufficient performance resource of the Webclient may lead to a decline in the processing capability of the mainprocess of the Web client and delayed playing of the video dataprocessed by the main process, which affects the user experience. Inorder to reduce the occurrence frequency of this phenomenon and make thevideo playing smooth, the Web client can monitor the performanceresource to determine whether the performance resource of Web client isinsufficient.

When it is determined that the performance resource of the Web client issufficient, the main process of the Web client can continue to performthe video-preprocessing on the video data to be played and play thevideo data obtained after the video-preprocessing. When it is determinedthat the performance resource of the Web client is insufficient, theabove step S102 is executed.

In one implementation, when the performance resource of the Web clientis insufficient, before the step of creating and starting the videoservice process (step S102), the following steps may also be included.

At step 1, the Web client can acquire the duration of performing thevideo-preprocessing on a video frame that has been subjected to thevideo-preprocessing in the video data.

Wherein the video data acquired by the main process of the Web clientmay include several frames of image, and each frame image is sortedaccording to the time sequence of playing. The main process of the Webclient performs the video-preprocessing on each frame image according tothe sequence of the frame images.

For example, the video data includes N frames of image, and the sequenceof the N frames of image is: the first frame image, the second frameimage . . . the Nth frame image. After the main process of the Webclient obtains the video data, it performs video-preprocessing onfirstly the first frame image, then the second frame image, and finallythe Nth frame image.

The duration of the main process performing the video-preprocessing oneach frame image can be the same or different. For example, when theperformance resource of the Web client is sufficient, the duration ofthe main process performing the video-preprocessing on each frame imageis short; when the performance resource of the Web client isinsufficient, the duration of the main process performing thevideo-preprocessing on each frame image is long.

When the main process performs the video-preprocessing on each frameimage, the Web client can record the duration of performing thevideo-preprocessing on each frame image. In this way, the duration ofperforming the video-preprocessing on each frame image that has beensubjected to the video-preprocessing is recoded in the Web client. TheWeb client can directly acquire the duration, that is, it can acquirethe duration of performing the video-preprocessing on the frame imagethat has been subjected to the video-preprocessing.

At step 2, calculating the total duration of performing thevideo-preprocessing on continuous frame images based on the duration ofperforming the video-preprocessing on the acquired frame image and thepreset number of the continuous frame images.

Wherein the preset number can be customized. For example, it isgenerally considered that when playing a video, it is a normal playingspeed to play 25 frame images in 1 second, and when the number of frameimages played in 1 second is less than 25, the playing delay will occur.Therefore, the preset number can be set to 25.

The selected preset number of frame images are frame images that havebeen subjected to the video-preprocessing, and the selected frame imagesare continuous. For example, if the preset number is 25, the selected 25consecutive frame images may be 25 consecutive images starting from the11th frame image, that is, the 35th frame image is the last selectedimage.

The initial image of the selected preset number of consecutive frameimages may be selected by users. Generally, in order to improve theaccuracy of the judgment result, a frame image closer to the currenttime can be selected as the initial image.

For example, if the current time is exactly 10:00:01, the frame imagesubjected to the video-preprocessing in the previous second can beselected as the initial image. That is, the frame image subjected to thevideo-preprocessing at 10:00:00 is selected as the initial image. Apreset number of consecutive frame images starting from the initialimage are used as the selected images.

For the selected preset number of consecutive frame images, the durationof performing the video-preprocessing on each frame image can beacquired. The duration for each frame image is summed to obtain thetotal duration of performing the video-preprocessing on the continuousframe images.

For example, the preset number is 25. In the selected 25 consecutiveframe images, the duration of performing the video-preprocessing on eachframe image is 40 milliseconds. Then the total duration of performingthe video-preprocessing on the 25 consecutive frame images is 1 second.

At step 3, determining whether the total duration is greater than apreset duration threshold; if it is greater than the preset durationthreshold, determining that the performance resource of the Web clientis insufficient; otherwise, determining that the performance resource ofthe Web client is sufficient.

Wherein the preset duration threshold can be customized. In oneimplementation, the preset duration threshold may be set according tothe aforementioned preset number.

For example, when the aforementioned preset number is set to 25, thepreset duration threshold may be set to 1 second. In this case, when thetotal duration corresponding to 25 frame images is greater than 1second, it means that 25 frame images cannot be played within 1 second.At this time, it can be determined that the performance resource of theWeb client is insufficient and the video playing is delayed. When thetotal duration corresponding to 25 frame images is not greater than 1second, it means that 25 frame images can be played within 1 second. Atthis time, it can be determined that the performance resource of the Webclient is sufficient and the video playing is normal.

In one implementation, the step 1 in the foregoing implementation, atwhich the Web client can acquire the duration of performing thevideo-preprocessing on the video frames that have been subjected to thevideo-preprocessing in the video data, may include the following steps.

At step A, the current time point is recorded as an initial time pointwhen starting to perform the video-preprocessing on the frame images inthe video data.

Wherein the object whose time point is recorded as the initial timepoint can be any frame image subjected to the video-preprocessing by themain process of the Web client.

In one implementation, when the Web client detects that the main processstarts to perform the video-preprocessing on one frame image in thevideo data, the current time point is acquired as the initial time pointof the frame image.

At step B, when the main process completes the video-preprocessing onthe frame image, the current time point is recorded as an end timepoint.

The frame image for the record of the end time point and the frame imagefor the record of the initial time point are the same frame image. Inone implementation, when the Web client detects that the main processcompletes the video-preprocessing on the frame image, the current timepoint is acquired as the end time point of the frame image.

At step C, after the initial time point and the end time point of theframe image are acquired, the duration of performing thevideo-preprocessing on the frame image is obtained by subtracting theinitial time point from the end time point.

For example, for the frame image “a” in the video data, when the mainprocess of the Web client starts to perform the video-preprocessing onthe frame image “a”, the current time point is exactly 10:00:00, andthis time point is recorded as the initial time point of the frame image“a”. When the main process of the Web client completes thevideo-preprocessing on the frame image “a”, the current time point is 40milliseconds past 10:00:00, and this time point is recorded as the endtime point of the frame image “a”. A duration of 40 milliseconds isobtained by subtracting the recorded initial time point from the endtime point, that is, the duration of performing the video-preprocessingon the frame image “a” is 40 milliseconds.

In one implementation, when the Web client is started, the main processof the Web client will preferentially connect with the video serviceprocess. If the main process of the Web client fails to connect with thevideo service process, the above step S101 is executed.

Wherein the failure in the connection between the main process of theWeb client and the video service process may include the following twosituations. In the first case, if the video service process is notstarted or fails to start, the connection between the main process ofthe Web client and the video service process will fail. In the secondcase, if the video service process is not installed in the device wherethe web client is installed, the connection between the main process ofthe web client and the video service process will fail.

If the main process of the Web client is successfully connected to thevideo service process, the Web client is communicated with the videoservice process so that the video service process performs thevideo-preprocessing on video data to be played, and plays the video dataobtained after the video-preprocessing.

In the technical solutions provided in the embodiments of thisapplication, the main process of the Web client performsvideo-preprocessing on video data to be played, and plays the video dataobtained after the video-preprocessing; and creates and starts a videoservice process when the performance resource of the Web client isinsufficient. Wherein the video service process is configured to performthe video-preprocessing on video data to be played and play the videodata obtained after the video-preprocessing. In the technical solutionaccording to the embodiment in the present application, the main processof the Web client can play videos without relying on plug-ins. When theperformance resource of the Web client is insufficient, the videoservice process is used to play the videos for the smoothness of videoplaying, which can also play videos without relying on plug-ins. Thus,videos can be played without relying on plug-ins by means of thissolution.

An embodiment of the present application also provides a video playingmethod. As shown in FIG. 2 , the video playing method includes thefollowing steps:

At S201, performing video-preprocessing on video data to be played, andplaying the video data obtained after the video-preprocessing by meansof a main process of the Web client;

At S202, recording the current time point as an initial time point whenstarting to perform the video-preprocessing on a frame image in thevideo data;

At S203, recording the current time point as an end time point when thevideo-preprocessing on the frame image is completed;

At S204, obtaining the duration of performing the video-preprocessing onthe frame image by subtracting the initial time point from the end timepoint;

At S205, calculating a total duration of performing thevideo-preprocessing on continuous frame images based on the duration ofperforming the video-preprocessing on the acquired frame image and thepreset number of the continuous frame images;

At S206, determining whether the total duration is greater than a presetduration threshold; if so, performing the step S207; otherwise,determining that the performance resource of the Web client issufficient;

At S207, prompting a user to choose whether to create a video serviceprocess. If the user chooses to create a video service process,executing the step S208; otherwise, executing the step S209;

At S208, creating and starting the video service process, andestablishing a connection between the video service process and the mainprocess;

At S209, performing frame-extraction-processing on the video data to beplayed, performing the video-preprocessing on the video data obtainedafter the frame-extraction-processing, and playing the video dataobtained after the video-preprocessing by means of the main process.

Corresponding to the foregoing embodiment of the video playing method,an embodiment of the present application also provides a video playingapparatus applied to a Web client. As shown in FIG. 3 , the videoplaying apparatus includes:

a processing module 310, configured for performing video-preprocessingon video data to be played and playing the video data obtained after thevideo-preprocessing by means of a main process of the Web client;

a creation module 320, configured for creating and starting a videoservice process when the performance resource of the Web client isinsufficient, wherein the video service process is configured to performthe video-preprocessing on video data to be played and play the videodata obtained after the video-preprocessing.

In one implementation, the apparatus may further include:

-   -   a prompt module, configured for prompting a user to choose        whether to create a video service process;    -   wherein the creation module 320 is specifically configured for:    -   creating and starting the video service process, and        establishing a connection between the video service process and        the main process in the case that the user chooses to create a        video service process.

In one implementation, the apparatus may further include:

-   -   a frame extraction module, configured for performing        frame-extraction-processing on the video data to be played in        the case that the user chooses not to create a video service        process;    -   a preprocessing module, configured for performing the        video-preprocessing on the video data obtained after the        frame-extraction-processing, and playing the video data obtained        after the video-preprocessing by means of the main process.

In one implementation, the creation module 320 is specifically used for:

-   -   acquiring and installing an installation package of the video        service process;    -   starting the video service process, and establishing a        connection between the video service process and the main        process after the installation is completed.

In one implementation, the apparatus may further include:

-   -   an acquisition module, configured for acquiring the duration of        performing the video-preprocessing on the frame image that has        been subjected to the video-preprocessing in the video data;    -   a calculation module, configured for calculating the total        duration of performing the video-preprocessing on continuous        frame images based on the duration of performing the        video-preprocessing on the acquired frame image and the preset        number of the continuous frame images;    -   a judgment module, configured for determining whether the total        duration is greater than a preset duration threshold; if it is        greater than the preset duration threshold, determining that the        performance resource of the Web client is insufficient;        otherwise, determining that the performance resource of the Web        client is sufficient.

In one implementation, the acquisition module is specifically configuredfor:

-   -   recording the current time point as an initial time point when        starting to perform the video-preprocessing on the frame images        in the video data;    -   recording the current time point as an end time point when the        video-preprocessing on the frame image is completed;    -   obtaining the duration of performing the video-preprocessing on        the frame image by subtracting the initial time point from the        end time point.

In the technical solutions provided in the embodiments of thisapplication, a main process of the Web client performs thevideo-preprocessing on video data to be played, and plays the video dataobtained after the video-preprocessing; and creates and starts a videoservice process when the performance resource of the Web client isinsufficient. Wherein the video service process is configured to performthe video-preprocessing on video data to be played and play the videodata obtained after the video-preprocessing. In the technical solutionaccording to the embodiment in the present application, the main processof the Web client can play videos without relying on plug-ins. When theperformance resource of the Web client is insufficient, the videoservice process is used to play videos for the smoothness of videoplaying, which can also play videos without relying on plug-ins. Thus,videos can be played without relying on plug-ins by means of thissolution.

Corresponding to the embodiment of the above video playing method, anembodiment of the present application provides an electronic device, asshown in FIG. 4 , which includes a processor 410, a communicationinterface 420, a memory 430 and a communication bus 440, wherein theprocessor 410, the communication interface 420 and the memory 430 arecommunicated with each other via the communication bus 440;

-   -   the memory 430 is used for storing computer programs;    -   the processor 410 is used for implementing the following steps        when executing the programs stored on the memory 430:    -   performing the video-preprocessing on video data to be played        and playing the video data obtained after the        video-preprocessing by means of a main process of the Web        client;    -   when the performance resource of the Web client is insufficient,        creating and starting a video service process, wherein the video        service process is configured to perform the video-preprocessing        on video data to be played and play the video data obtained        after the video-preprocessing.

In a possible implementation, the processor 410 may also implement anyone of the foregoing video playing method when being executed by theprograms stored on the memory 430.

In the technical solution according to the embodiment in the presentapplication, the main process of the Web client can play videos withoutrelying on plug-ins. When the performance resource of the Web client isinsufficient, the video service process is used to play videos for thesmoothness of video playing, which can also play videos without relyingon plug-ins. Thus, videos can be played without relying on plug-ins bymeans of this solution.

The communication bus aforementioned in the electronic device may be aperipheral component interconnect (PCI) bus or an extended industrystandard architecture (EISA) bus and the like. The communication bus caninclude an address bus, a data bus, a control bus, or the like. Forrepresentation, only one thick line is shown in the figure, which doesnot mean there is only one communication bus or one type ofcommunication bus.

The communication interface is used for communication between theaforementioned electronic device and other devices.

The memory can include a random access memory (RAM), or can include anon-volatile memory (NVM), for example at least one disk memory.Optionally, the memory can also be at least one storage device locatedaway from the processor described above.

The aforementioned processor can be a general-purpose processor,including a central processing unit (CPU), a network processor (NP), orthe like; it can also be a digital signal processor (DSP), anapplication specific integrated circuit (ASIC), a field-programmablegate array (FPGA) or other programmable logic device, a discrete gate ora transistor logic device, a discrete hardware component.

Corresponding to the above embodiments of the video playing methods, anembodiment of the present application provides a machine readablestorage medium. The machine readable storage medium stores computerprograms thereon which, when executed by a processor, cause theprocessor to implement the steps of any one of the video playing methodsdescribed above.

The embodiments of the present application also provide a computerprogram product, which implements any one of the foregoing video playingmethod when being executed by a processor.

It should be noted that the relationship terms herein such as “first”,“second”, and the like are only used for distinguishing one entity oroperation from another entity or operation, but do not necessarilyrequire or imply that there is any actual relationship or order betweenthese entities or operations. Moreover, the terms “include”, “comprise”or any other variants thereof are intended to cover non-exclusiveinclusions, so that processes, methods, articles or devices including aseries of elements include not only those elements listed but also thosenot specifically listed or the elements intrinsic to these processes,methods, articles, or devices. Without further limitations, elementsdefined by the sentences “comprise(s) a.” or “include(s) a.” do notexclude that there are other identical elements in the processes,methods, articles, or devices which include these elements.

All the embodiments in the description are described in correspondingways, same or similar parts in each of the embodiments can be referredto one another, and the parts emphasized are differences to otherembodiments. For the embodiments of the video playing apparatus, the Webclient, and the machine readable storage medium, since they are similarto the embodiments of the video playing methods, the description thereofis relatively simple; the relating parts could refer to the parts of thedescription of embodiments of the method.

The above description is only for preferred embodiments of the presentapplication, and is not intended to limit the present application. Anymodifications, substitutions, improvements, etc., which are made withinthe spirit and principles of the present application, will fall into theprotection scope of the present application.

What is claimed is:
 1. A video playing method, wherein it is applied toa Web client and comprises: performing video-preprocessing on video datato be played, and playing the video data obtained after thevideo-preprocessing by means of a main process of the Web client;creating and starting a video service process when a performanceresource of the Web client is insufficient, wherein the video serviceprocess is configured to perform the video-preprocessing on video datato be played and play the video data obtained after thevideo-preprocessing.
 2. The method of claim 1, further comprising:providing a prompt to choose whether to create a video service process;creating and starting a video service process comprises: in a case thatit is chosen to create a video service process, creating and startingthe video service process, and establishing a connection between thevideo service process and the main process.
 3. The method of claim 2,further comprising: in a case that it is chosen not to create a videoservice process, performing frame-extraction-processing on the videodata to be played; performing the video-preprocessing on the video dataobtained after the frame-extraction-processing, and playing the videodata obtained after the video-preprocessing by means of the mainprocess.
 4. The method of claim 1, wherein creating and starting a videoservice process comprises: acquiring and installing an installationpackage of the video service process; after the installation iscompleted, starting the video service process and establishing aconnection between the video service process and the main process. 5.The method of claim 1, wherein before the step of creating and startinga video service process when the performance resource of the Web clientis insufficient, the method further comprises: acquiring a duration ofperforming the video-preprocessing on a frame image that has beensubjected to the video-preprocessing in the video data; calculating atotal duration of performing the video-preprocessing on continuous frameimages based on the duration of performing the video-preprocessing onthe acquired frame image and a preset number of the continuous frameimages; when the total duration is greater than the preset durationthreshold, determining that the performance resource of the Web clientis insufficient; when the total duration is not greater than the presetduration threshold, determining that the performance resource of the Webclient is sufficient.
 6. The method of claim 5, wherein the step ofacquiring the duration of performing the video-preprocessing on theframe image that has been subjected to the video-preprocessing in thevideo data comprises: recording a current time point as an initial timepoint when starting to perform the video-preprocessing on the frameimage in the video data; recording a current time point as an end timepoint when the video-preprocessing on the frame image is completed;obtaining the duration of performing the video-preprocessing on theframe image by subtracting the initial time point from the end timepoint.
 7. An electronic device, wherein it comprises a processor and amemory; the memory is used for storing computer programs; the processoris used for implementing the video playing method of claim 1 whenexecuting the programs stored on the memory.
 8. A non-transitorycomputer readable storage medium, wherein the non-transitory computerreadable storage medium stores computer programs thereon which, whenexecuted by a processor, cause the processor to implement the videoplaying method of claim
 1. 9. The electronic device of claim 7, whereinthe processor is used for further: providing a prompt to choose whetherto create a video service process; wherein creating and starting a videoservice process comprises: in a case that it is chosen to create a videoservice process, creating and starting the video service process, andestablishing a connection between the video service process and the mainprocess.
 10. The electronic device of claim 9, wherein the processor isused for further: in a case that it is chosen not to create a videoservice process, performing frame-extraction-processing on the videodata to be played; performing the video-preprocessing on the video dataobtained after the frame-extraction-processing, and playing the videodata obtained after the video-preprocessing by means of the mainprocess.
 11. The electronic device of claim 7, wherein creating andstarting a video service process comprises: acquiring and installing aninstallation package of the video service process; after theinstallation is completed, starting the video service process andestablishing a connection between the video service process and the mainprocess.
 12. The electronic device of claim 7, wherein before the stepof creating and starting a video service process when the performanceresource of the Web client is insufficient, the processor is used forfurther: acquiring a duration of performing the video-preprocessing on aframe image that has been subjected to the video-preprocessing in thevideo data; calculating a total duration of performing thevideo-preprocessing on continuous frame images based on the duration ofperforming the video-preprocessing on the acquired frame image and apreset number of the continuous frame images; when the total duration isgreater than the preset duration threshold, determining that theperformance resource of the Web client is insufficient; when the totalduration is not greater than the preset duration threshold, determiningthat the performance resource of the Web client is sufficient.
 13. Theelectronic device of claim 12, wherein the step of acquiring theduration of performing the video-preprocessing on the frame image thathas been subjected to the video-preprocessing in the video datacomprises: recording a current time point as an initial time point whenstarting to perform the video-preprocessing on the frame image in thevideo data; recording a current time point as an end time point when thevideo-preprocessing on the frame image is completed; obtaining theduration of performing the video-preprocessing on the frame image bysubtracting the initial time point from the end time point.
 14. Thenon-transitory computer readable storage medium of claim 8, wherein theprocessor is caused to implement an operation of: providing a prompt tochoose whether to create a video service process; wherein creating andstarting a video service process comprises: in a case that it is chosento create a video service process, creating and starting the videoservice process, and establishing a connection between the video serviceprocess and the main process.
 15. The non-transitory computer readablestorage medium of claim 14, wherein the processor is used for further:in a case that it is chosen not to create a video service process,performing frame-extraction-processing on the video data to be played;performing the video-preprocessing on the video data obtained after theframe-extraction-processing, and playing the video data obtained afterthe video-preprocessing by means of the main process.
 16. Thenon-transitory computer readable storage medium of claim 8, whereincreating and starting a video service process comprises: acquiring andinstalling an installation package of the video service process; afterthe installation is completed, starting the video service process andestablishing a connection between the video service process and the mainprocess.
 17. The non-transitory computer readable storage medium ofclaim 8, wherein before the step of creating and starting a videoservice process when the performance resource of the Web client isinsufficient, the processor is caused to implement operations of:acquiring a duration of performing the video-preprocessing on a frameimage that has been subjected to the video-preprocessing in the videodata; calculating a total duration of performing the video-preprocessingon continuous frame images based on the duration of performing thevideo-preprocessing on the acquired frame image and a preset number ofthe continuous frame images; when the total duration is greater than thepreset duration threshold, determining that the performance resource ofthe Web client is insufficient; when the total duration is not greaterthan the preset duration threshold, determining that the performanceresource of the Web client is sufficient.
 18. The non-transitorycomputer readable storage medium of claim 17, wherein the step ofacquiring the duration of performing the video-preprocessing on theframe image that has been subjected to the video-preprocessing in thevideo data comprises: recording a current time point as an initial timepoint when starting to perform the video-preprocessing on the frameimage in the video data; recording a current time point as an end timepoint when the video-preprocessing on the frame image is completed;obtaining the duration of performing the video-preprocessing on theframe image by subtracting the initial time point from the end timepoint.